home *** CD-ROM | disk | FTP | other *** search
- /*
- *--- opencpy.cpp ----------------------------------------------------------
- * Copyright (c) 1992-96 Adobe Systems, Inc. All rights reserved.
- *
- * PageMaker plug-in OpenCopy.
- *-----------------------------------------------------------------------
- */
-
- /* ---------------- PageMaker SDK include files ---------------- */
- #include "PMPlugin.h"
-
- /* ---------------- Plug-in include files ---------------- */
- #include "OpenCpy.h"
- #ifdef MACINTOSH
- #include "WinTypes.h"
- #include "PStrUtils.h"
- #endif // MACINTOSH
-
- /* ---------------- Cross-platform include files ---------------- */
-
- /* ---------------- Platform specific include files ---------------- */
- #ifdef MACINTOSH
- #include <types.h>
- #ifndef powerc
- #include <A4Stuff.h>
- #include <SetUpA4.h>
- #endif
- #else
- #include <windows.h>
- #endif
-
- /* ---------------- Type definitions ---------------- */
-
- /* ---------------- Definitions ---------------- */
- #define CB_PATH_BUFF 1000
- #define CB_NAME_BUFF 300
-
- /* ---------------- PageMaker (New)SDK include files ---------------- */
-
- /* ---------------- Globals ---------------- */
- extern sPMParamBlockPtr thePB;
-
- /* ---------------- Function declarations ---------------- */
- #ifdef WINDOWS
- extern BOOL FGetOpenFileName(char *szPName, short cbPSz, char *szSName, short cbSSz );
- #endif // WINDOWS
-
- void OpenPubCopy(void)
- {
- //return;
- BOOL result;
- #ifdef WINDOWS
- char *szPathName = NULL;
- char *szShortName = NULL;
- #endif //WINDOWS
- #ifdef MACINTOSH
- Point point;
- short numTypes = 1;
- SFTypeList typeList;
- SFReply reply;
- #endif // MACINTOSH
- struct OpenPub {
- char szPathDestination[91];
- short how;
- } OpenRec;
-
- #ifdef WINDOWS
- szPathName = (char *)GlobalAlloc( GPTR, CB_PATH_BUFF );
- szShortName = (char *)GlobalAlloc( GPTR, CB_NAME_BUFF );
-
- if ( !szPathName || !szShortName )
- goto cleanup;
-
- result = FGetOpenFileName(szPathName, CB_PATH_BUFF, szShortName, CB_NAME_BUFF);
-
- memset(OpenRec.szPathDestination, 0, 91);
-
- strncpy( OpenRec.szPathDestination, szPathName, 91 );
- #endif // WINDOWS
-
- #ifdef MACINTOSH
- point.h = 100;
- point.v = 100;
- typeList[0] = 'AB65';
-
- SFGetFile(point, "\pLocate PageMaker file:", nil, numTypes, typeList,
- nil, &reply);
-
- if (reply.good == false)
- return;
-
- memset(OpenRec.szPathDestination, 0, 91);
-
- p_to_c( OpenRec.szPathDestination, reply.fName);
-
- #endif //MACINTOSH
- /*
- struct OpenPub {
- char szPathDestination[91];
- short how;
- } OpenRec;
- */
- OpenRec.how = 1;
-
- result = PBBinCommand(thePB, pm_open, kXRSPointer, &OpenRec, sizeof(struct OpenPub));
-
- cleanup:
- #ifdef WINDOWS
- if ( szPathName )
- GlobalFree( szPathName );
- if ( szShortName )
- GlobalFree( szShortName );
- #endif //WINDOWS
- #ifdef MACINTOSH
-
- #endif // MACINTOSH
- return;
- }
-